<?php /* Smarty version Smarty-3.1.12, created on 2016-07-11 14:16:46
         compiled from "D:\phpStudy\WWW\demonew\dm\xycms\region.tpl" */ ?>
<?php /*%%SmartyHeaderCode:15883578339ce8c8cd3-67058109%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'c6f114ed507cf9fd9dbc35e0afa3e02013624b55' => 
    array (
      0 => 'D:\\phpStudy\\WWW\\demonew\\dm\\xycms\\region.tpl',
      1 => 1429337970,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '15883578339ce8c8cd3-67058109',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'page_charset' => 0,
    'urlpath' => 0,
    'action' => 0,
    'region' => 0,
    'count' => 0,
    'volist' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.12',
  'unifunc' => 'content_578339ce962209_59920428',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_578339ce962209_59920428')) {function content_578339ce962209_59920428($_smarty_tpl) {?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $_smarty_tpl->tpl_vars['page_charset']->value;?>
" />
<title>区域管理</title>
<link type="text/css" rel="stylesheet" href="<?php echo $_smarty_tpl->tpl_vars['urlpath']->value;?>
dm/xycms/css/admin.css" media="screen" />
<link type="text/css" rel="stylesheet" href="<?php echo $_smarty_tpl->tpl_vars['urlpath']->value;?>
dm/xycms/css/region.css" />
<script type='text/javascript' src='<?php echo $_smarty_tpl->tpl_vars['urlpath']->value;?>
dm/js/jquery-1.8.3.min.js'></script>
<script type='text/javascript' src='<?php echo $_smarty_tpl->tpl_vars['urlpath']->value;?>
dm/js/command.js'></script>
</head>
<body>
<?php if ($_smarty_tpl->tpl_vars['action']->value=="add"){?>
<div class="main-wrap">
  <div class="path"><p>当前位置：区域管理</p></div>
<div class="main-cont">
	<h3 class="title">添加区域</h3>
    <form name="myform" id="myform" method="post" action="<?php echo $_smarty_tpl->tpl_vars['urlpath']->value;?>
dm/region.php/add/saveadd/">
	<table cellpadding='3' cellspacing='3' class='tab'>
	  <tr>
		<td class='hback_1' width="10%">区域 </td>
		<td class='hback' width="85%"><input type="text" name="name" id="name" class="input-txt input1" /></td>
	  </tr>
	  <tr>
		<td class='hback_1'>英文</td>
		<td class='hback'><input type="text" name="en" id="en" class="input-txt input1" /></td>
	  </tr>
	  <tr>
		<td class='hback_none'></td>
		<td class='hback_none'><input type="submit" name="btn_save" class="button btn1" value="添加保存" /></td>
	  </tr>
	</table>
	</form>
  </div>
</div>
<?php }elseif($_smarty_tpl->tpl_vars['action']->value=="edit"){?>
<div class="main-wrap">
  <div class="path"><p>当前位置：区域管理</p></div>
<div class="main-cont">
	<h3 class="title">编辑区域</h3>
    <form name="myform" id="myform" method="post" action="<?php echo $_smarty_tpl->tpl_vars['urlpath']->value;?>
dm/region.php/edit/">
    <input type="hidden" name="id" value="<?php echo $_smarty_tpl->tpl_vars['region']->value['id'];?>
" />
	<table cellpadding='3' cellspacing='3' class='tab region_tab'>
	  <tr>
		<td class="region_title" width="10%">区域：</td>
		<td width="85%"><input type="text" name="name" id="name" class="input-txt input1" value="<?php echo $_smarty_tpl->tpl_vars['region']->value['name'];?>
" /></td>
	  </tr>
	  <tr>
		<td class="region_title">英文：</td>
		<td><input type="text" name="en" id="en" class="input-txt input1" value="<?php echo $_smarty_tpl->tpl_vars['region']->value['en'];?>
" /></td>
	  </tr>
	  <tr>
		<td></td>
		<td><input type="submit" name="btn_save" class="button btn1" value="保存编辑" /></td>
	  </tr>
	</table>
	</form>
  </div>
</div>
<?php }else{ ?>
<div class="main-wrap">
  <div class="path"><p>当前位置：区域管理</p></div>
<div class="main-cont">
	<h3 class="title">所有区域<span id="region_count">[ <label><?php echo $_smarty_tpl->tpl_vars['count']->value;?>
</label> ]</span></h3>
	<input type="hidden" name="delurl" id="delurl" value="<?php echo $_smarty_tpl->tpl_vars['urlpath']->value;?>
dm/region.php/del/" />
	<ul class="region_list clear">
		<?php  $_smarty_tpl->tpl_vars['volist'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['volist']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['region']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['volist']->key => $_smarty_tpl->tpl_vars['volist']->value){
$_smarty_tpl->tpl_vars['volist']->_loop = true;
?>
			<li>
			<a href="<?php echo $_smarty_tpl->tpl_vars['urlpath']->value;?>
dm/region.php/edit/<?php echo $_smarty_tpl->tpl_vars['volist']->value['id'];?>
" class="item"><?php echo $_smarty_tpl->tpl_vars['volist']->value['name'];?>
</a>
			<a href="javascript:void(0);" class="del" rel="<?php echo $_smarty_tpl->tpl_vars['volist']->value['id'];?>
">删除</a>
			</li>
		<?php } ?>
	</ul>
	<div class="ContextMenu">
		<a href="javascript:void(0);" rel="">删除</a>
	</div>
  </div>
</div>
<?php }?>
  <script>
  $('.btn1').live('click',function(){
	  if($('#name').val() == ''){
		  alert('城市名称不可以空');
		  $('#name').focus();
		  return false;
	  }
  });
	$('.region_list >li a.del').live('click',function(){
 			var id = $(this).attr('rel');
 			var liObj = $(this).parent();
 			url = $('#delurl').val();
 			$.ajax({
 			   type: "GET",
 			   url: url,
 			   data: {'id':id},
 			   success: function(msg){
 				   if(msg == 1){
  					  alert('删除成功');
 					  liObj.remove();
 					  $('#region_count label').text(parseInt($('#region_count label').text())-1);

 				   }
 			   }
 			});
 	}); 
  </script>
</body>
</html><?php }} ?>